(in-package #:test.com.alibaba.fastjson)

(test eq1
  (let* ((a -1)
        (b nil)
        (c (forName (make-instance 'Reflector) 'JSONPath))
	(m (ensure-generic-function 'eq))
	(retval (funcall m (make-instance 'JSONPath) a b))
	)
    (is (null retval)))
  )

(test eq2
  (let* ((a nil)
	(b nil)
	(c (forName (make-instance 'Reflector) 'JSONPath))
	(m (ensure-generic-function 'eq))
	(retval (funcall m (make-instance 'JSONPath) a b))
	 )
    (format t "~%~A==~A~%" retval (cl:eq retval 'T))
    (is (cl:eq retval 'T))))

(test isDigitFirst1
  (let* ((ch #\2)
	 (c (forName (make-instance 'Reflector) 'JSONPathParser))
	 (m (ensure-generic-function 'isDigitFirst))
	 (retval (funcall m (make-instance 'JSONPathParser) ch))
	 )
    (is (cl:eq retval 'T))))

(test isDigitFirst2
  (let* ((ch #\:)
	 (c (forName (make-instance 'Reflector) 'JSONPathParser))
	 (m (ensure-generic-function 'isDigitFirst))
	 (retval (funcall m (make-instance 'JSONPathParser) ch))
	 )
    (is (cl:eq retval 'nil))))

(test isDigitFirst3
  (let* ((ch #\u0000)
	 (c (forName (make-instance 'Reflector) 'JSONPathParser))
	 (m (ensure-generic-function 'isDigitFirst))
	 (retval (funcall m (make-instance 'JSONPathParser) ch))
	 )
    (is (cl:eq retval 'nil))))

(test isEOF1
  (let* ((objectUnderTest (getInstance (make-instance 'Reflector) 'JSONPathParser))
	 (path (setField (make-instance 'Reflector) objectUnderTest "path" "path"))
	 (pos (setField (make-instance 'Reflector) objectUnderTest "pos" -2147483647))
	 (level(setField (make-instance 'Reflector) objectUnderTest "level" 0))
	 (ch (setField (make-instance 'Reflector) objectUnderTest "ch" #\u0000))
	 (c (forName (make-instance 'Reflector) 'JSONPathParser))
	 (m (ensure-generic-function 'isEOF))
	 (retval (funcall m objectUnderTest))
	 )
    (is (cl:eq retval 'nil))))

(test isEOF2
  (let* ((objectUnderTest (getInstance (make-instance 'Reflector) 'JSONPathParser))
	 (path (setField (make-instance 'Reflector) objectUnderTest "path" "!"))
	 (pos (setField (make-instance 'Reflector) objectUnderTest "pos" 1))
	 (level(setField (make-instance 'Reflector) objectUnderTest "level" 0))
	 (ch (setField (make-instance 'Reflector) objectUnderTest "ch" #\u0000))
	 (c (forName (make-instance 'Reflector) 'JSONPathParser))
	 (m (ensure-generic-function 'isEOF))
	 (retval (funcall m objectUnderTest))
	 )
    (is (cl:eq retval 'T))))

(test my-test
  (is (= 2 (+ 1 1))))

;; done
